/*
角色信息界面
*/
window._MRDL = {

    paramLength:65,//五位图边长

    maxlength:1500,

    _MAINLABEL:null,
    _PAGEINDEX:0,
    _ROLEARR:null,
    _CURRENTSENCE:null,//当前场景
    _PARENTNODE:null,
    _UISCAL:1,

    _SKILLPAGENSIZE:12,
    _SKILLPAGENMB:0,

    _XWPAGESIZE:9,
    _XWPAGENMB:0,

    initUi:function(parentNode,param){

        if(!param)
            return;

        _MRDL._CURRENTSENCE = param.sence;
        _MRDL._PARENTNODE = parentNode;

        var uiObj = _GRM.getNodeObj('roleInfoLabel');
        var mainLabel = uiObj.node;
        _MRDL._MAINLABEL = mainLabel;
        _MRDL._PAGEINDEX=param.roleIndex?param.roleIndex:0;
        _MRDL._ROLEARR=param.roleArr;

        _MRDL._SKILLPAGENMB=0;
        _MRDL._XWPAGENMB=0;

        if(uiObj.isnew){
            this.initButton(mainLabel);
        }

        _MRDL.switchLabel('mainLabel');
        _MRDL.refreshPage();
        parentNode.addChild(mainLabel);

        if(param.scal){
            mainLabel.setScale(param.scal,param.scal);
            _MRDL._UISCAL=param.scal;
        }else{
            mainLabel.setScale(1,1);
            _MRDL._UISCAL=1;
        }

        return mainLabel;
    },

    initButton:function(mainLabel){

        /*
        var infoNode = mainLabel.getChildByName('mainLabel').getChildByName('info');
        infoNode.getChildByName('job').on(cc.Node.EventType.TOUCH_START, function(){
            //console.log(this.job);
            //_TIPS.showMessage(JOBHELPER.getJobDesc(this.job),0);
            _MJOB.showJobDes({role:this.role,scal:_MRDL._UISCAL});

        }, infoNode.getChildByName('job'));*/

        var tjrhbtn = mainLabel.getChildByName('mainLabel').getChildByName('tjrhbtn');
        tjrhbtn.on(cc.Node.EventType.TOUCH_START, function(){
            var role = _MRDL._ROLEARR[_MRDL._PAGEINDEX];
            _RHTJ.showRHTj(_MAP.node,{role:role});
        }, mainLabel);

        var yjrhbtn = mainLabel.getChildByName('mainLabel').getChildByName('yjrhbtn');
        yjrhbtn.on(cc.Node.EventType.TOUCH_START, function(){
            var role = _MRDL._ROLEARR[_MRDL._PAGEINDEX];
            //_RHTJ.showRHTj(_MAP.node,{role:role});
            console.log('一键融合');
            _CHOICEMANAGER.showChoice(_MAP.node,'rhAll',{role:role});
        }, mainLabel);

        mainLabel.getChildByName('mask')
            .on(cc.Node.EventType.TOUCH_START, function(){
                if(_MRDL._CURRENTSENCE!=_STYPE._GOODSSENCE)
                    _GRM.putNode(this);
            }, mainLabel);
        
        var tabButtons = mainLabel.getChildByName('tab').getChildren();
        var equipButtons = mainLabel.getChildByName('mainLabel').getChildByName('equip').getChildren();
        var skillButtons = mainLabel.getChildByName('skillLabel').getChildByName('skills').getChildren();
        var renameButton = mainLabel.getChildByName('mainLabel').getChildByName('info').getChildByName('xiugai');
        var btnLeft = mainLabel.getChildByName('page').getChildByName('btnLeft');
        var btnRight = mainLabel.getChildByName('page').getChildByName('btnRight');

        var btnLeftXw = mainLabel.getChildByName('xiuweiLabel').getChildByName('page')
                            .getChildByName('btnLeft');
        btnLeftXw.on(cc.Node.EventType.TOUCH_START,function(){
            _MRDL._XWPAGENMB--;
            if(_MRDL._XWPAGENMB<0){
                _MRDL._XWPAGENMB=0;
            }
            _MRDL.refreshXW();
        }, this);
        var btnRightXw = mainLabel.getChildByName('xiuweiLabel').getChildByName('page')
                            .getChildByName('btnRight');
        btnRightXw.on(cc.Node.EventType.TOUCH_START, function(){
            _MRDL._XWPAGENMB++;
            _MRDL.refreshXW();
        }, this);

        var btnLeftSkill = mainLabel.getChildByName('skillLabel').getChildByName('page')
                            .getChildByName('btnLeft');
        btnLeftSkill.on(cc.Node.EventType.TOUCH_START, function(){
                                _MRDL._SKILLPAGENMB--;
                                if(_MRDL._SKILLPAGENMB<0){
                                    _MRDL._SKILLPAGENMB=0;
                                }
                                _MRDL.refreshAllSkill();
                            }, this);
        var btnRightSkill = mainLabel.getChildByName('skillLabel').getChildByName('page')
                            .getChildByName('btnRight');
        btnRightSkill.on(cc.Node.EventType.TOUCH_START, function(){
                                _MRDL._SKILLPAGENMB++;
                                _MRDL.refreshAllSkill();
                            }, this);

        renameButton.on(cc.Node.EventType.TOUCH_START, _MRDL.showRename, this);

        btnLeft.pageDir=-1;
        btnRight.pageDir=1;
        btnLeft.on(cc.Node.EventType.TOUCH_START, _MRDL.pageClick, btnLeft);
        btnRight.on(cc.Node.EventType.TOUCH_START, _MRDL.pageClick, btnRight);

        for(var i=0;i<skillButtons.length;i++){
            var skillbtn = skillButtons[i];
            skillbtn.skillIndex = i;
            skillbtn.on(cc.Node.EventType.TOUCH_START, _MRDL.showSkill, skillbtn);
        }

        for(var i=0;i<equipButtons.length;i++){
            var equipbtn = equipButtons[i].getChildByName('img');
            var yjdzbtn = equipButtons[i].getChildByName('start');
            equipbtn.equipIndex = i;
            equipbtn.on(cc.Node.EventType.TOUCH_START, _MRDL.showEquip, equipbtn);
            yjdzbtn.on(cc.Node.EventType.TOUCH_START, function(){
                var equip = this.equip;
                var oldattr = _CU.cloneObj(equip.attr);
                var role = this.role;
                _MDZ.yjdz(equip,role,oldattr);
                _MRDL.refreshPage();
            }, yjdzbtn);
        }

        for(var i=0;i<tabButtons.length;i++){
            var tapbtn = tabButtons[i];
            if(tapbtn.getName()!="job"){
                tapbtn.on(cc.Node.EventType.TOUCH_START, _MRDL.showTap, tapbtn);
            }else{
                
            }
        }

        var xwNodes = mainLabel.getChildByName('xiuweiLabel').getChildByName('bars').getChildren();
        for(var i=0;i<xwNodes.length;i++){
            xwNodes[i].on(cc.Node.EventType.TOUCH_START, function(){
                _TIPS.showMessage(XWH.showXwDes(this.xw));
            }, xwNodes[i]);
        }
    },


    getRoleStory:function(name,player){
        var npcconf = _NPC[name];
        if(npcconf){
            var result = "姓名:"+name;
            result+="\n性别:"+(npcconf.sex?'男':'女');
            if(player&&player.cha){
                result+="\n性格:"+(player.cha?player.cha:'未知');
            }else{
                result+="\n性格:"+(npcconf.cha?npcconf.cha:'未知');
            }
            result+="\n生平:"+(_ROLESTORY[name]?_ROLESTORY[name]:'暂无');
            return result;
        }else{
            return "查无此人";
        }
        
    },
	
	getRoleStoryByPlayer:function(player){
        
		if(player){
			var result = "姓名:"+player.name;
			if(player.sex==1){
				result+="\n性别:男";
			}else if(player.sex==0){
				result+="\n性别:女";
			}else{
				result+="\n性别:未知";
			}
				
            result+="\n性格:"+(player.cha?player.cha:'未知');
            return result;
		}
		
		return "未知";
        
    },


    //刷新种族和称号
    refreshRaceAndTitle:function(role,bossLvNode){

        var rolerace = role.race?role.race:"wu";
        var roletitle = role.roletitle?role.roletitle:"无";

        bossLvNode.getChildByName('label').getComponent(cc.Label).string = _RACE[rolerace].name;
        bossLvNode.color = new cc.color(_RACE[rolerace].color);
        bossLvNode.getChildByName('job').getComponent(cc.Label).string = roletitle;
        
    },

    getJobOfRole:function(role){
        if(role&&_NPC[role.npctype]){
            return _NPC[role.npctype].job;
        }

        return "wu";
    },

    getRaceOfRole:function(role){

        if(_NPC[role.npctype]){
            return _NPC[role.npctype].race;
        }

        return "wu";

    },

    refreshPage:function(){

        var role = _MRDL._ROLEARR[_MRDL._PAGEINDEX];
        //console.log(role);
        var roleData = _ROLEDATA.getRoleDataOfPlayer(role);
        var realjob = _JOB[_MRDL.getJobOfRole(role)];
        
        var mainLabel = _MRDL._MAINLABEL;
        var infoNode = mainLabel.getChildByName('mainLabel').getChildByName('info');
        var faceNode = mainLabel.getChildByName('mainLabel').getChildByName('face');
        var bossLvNode = mainLabel.getChildByName('mainLabel').getChildByName('lv');
        var barsNode = mainLabel.getChildByName('mainLabel').getChildByName('bars');
        var tjrhbtn = mainLabel.getChildByName('mainLabel').getChildByName('tjrhbtn');
        var yjrhbtn = mainLabel.getChildByName('mainLabel').getChildByName('yjrhbtn');
        
        var roleAttrStr = _ROLEDATA.getAttrString(false,roleData);
        //var storyStr = _NPC[role.name]?_MRDL.getRoleStory(role.name,role):_MRDL.getRoleStoryByPlayer(role);
        var expObj = _EXPMANAGER.getNextLevelExp(role.exp);
        
        var jobEquip = realjob.equipType;
        var realequip = role.equip;
        var equipNodes = mainLabel.getChildByName('mainLabel').getChildByName('equip').getChildren();

        //刷新形象
        //_CU.initAllAniNode(role.pf, mainLabel.getChildByName('mainLabel').getChildByName('player'));

        //刷新装备
        _MRDL.refreshEquipArr(equipNodes,jobEquip,realequip);

        //刷新技能
        _MRDL.refreshAllSkill();

        _MRDL.refreshXW();

        _MRDL.refreshLR(mainLabel);

        //_MRDL.refreshRaceAndTitle(role,bossLvNode);

        mainLabel.getChildByName('page').getChildByName('label').getComponent(cc.Label).string = role.name+" LV."+roleData.lv;

        infoNode.getChildByName('attack').getComponent(cc.Label).string = "攻击:"+_CU.getUnitNmb(roleData.attack);
        infoNode.getChildByName('willpower').getComponent(cc.Label).string = "精神:"+_CU.getUnitNmb(roleData.mattack);
        infoNode.getChildByName('defense').getComponent(cc.Label).string = "防御:"+_CU.getUnitNmb(roleData.defend);
        infoNode.getChildByName('mokang').getComponent(cc.Label).string = "魔防:"+_CU.getUnitNmb(roleData.mdefend);
        infoNode.getChildByName('name').getComponent(cc.Label).string = role.name;
        infoNode.getChildByName('job').getComponent(cc.Label).string = role.npctype;
        infoNode.getChildByName('job').job = roleData.realjob;
        infoNode.getChildByName('job').role = role;

        faceNode.getComponent(cc.Sprite).spriteFrame = _GRM.getFaceFrame(role.face);
        //faceNode.getChildByName('level').getComponent(cc.Label).string = "LV."+roleData.lv;
        //刷新种族 五行  职业
        //var roleQua = _NPC[role.npctype].level;
        var roleQua = _ROLEDATA.getRoleQua(role);
        var rolerace = _MRDL.getRaceOfRole(role);
        var rolejob = _MRDL.getJobOfRole(role);
        faceNode.getChildByName('level').getChildByName('label').getComponent(cc.Label).string = roleQua;
        faceNode.getChildByName('level').color = new cc.color(window._CS.qua[roleQua].color);
        faceNode.getChildByName('ftype').getChildByName('ftypeStr').getComponent(cc.Label).string = role.ftype;
        faceNode.getChildByName('ftype').color = new cc.color(window._CS.ftype[role.ftype].color);
        faceNode.getChildByName('job').getChildByName('label').getComponent(cc.Label).string = window._JOB[rolejob]?window._JOB[rolejob].sname:'?';
        faceNode.getChildByName('job').color = new cc.color(window._JOB[rolejob].color);
        faceNode.getChildByName('zhong').getChildByName('label').getComponent(cc.Label).string = window._RACE[rolerace].name;
        faceNode.getChildByName('zhong').color = new cc.color(window._RACE[rolerace].color);

        barsNode.getChildByName("exp").getChildByName("title").getComponent(cc.Label).string = "经验:"+_CU.getUnitNmb(expObj.cexp)+"/"+_CU.getUnitNmb(expObj.nexp);
		barsNode.getChildByName("hp").getChildByName("title").getComponent(cc.Label).string = "生命:"+_CU.getUnitNmb(role.hp)+"/"+_CU.getUnitNmb(roleData.maxHp);
		barsNode.getChildByName("angry").getChildByName("title").getComponent(cc.Label).string = "灯:"+role.mg+"/"+roleData.maxMagic;
		
		barsNode.getChildByName("angry").getChildByName("progress").getComponent(cc.ProgressBar).progress = role.mg/roleData.maxMagic;
		barsNode.getChildByName("hp").getChildByName("progress").getComponent(cc.ProgressBar).progress = role.hp/roleData.maxHp;
		barsNode.getChildByName("exp").getChildByName("progress").getComponent(cc.ProgressBar).progress = expObj.per;

        //副属性页面
        var attrStrText = mainLabel.getChildByName('addLabel')
                                    .getChildByName('scrollview')
                                    .getChildByName('view')
                                    .getChildByName('content')
                                    .getChildByName('zzstr');
        attrStrText.getComponent(cc.RichText).string = roleAttrStr;

        //绘制五位图
        _MRDL.drawSix(mainLabel
            .getChildByName('mainLabel')
            .getChildByName('five')
            .getChildByName('attr'),
            mainLabel
            .getChildByName('mainLabel')
            .getChildByName('five')
            .getChildByName('data').getComponent(cc.Graphics),[role.plv,role.dlv,role.ilv,role.mlv,role.hlv]);

        
        if(_MRDL._CURRENTSENCE==_STYPE._GOODSSENCE
            //||_MRDL._CURRENTSENCE==_STYPE._TEAMSENCE
        ){
            if(roleQua=='SS'){
                tjrhbtn.active = false;
                yjrhbtn.active = true;
            }else{
                tjrhbtn.active = true;
                yjrhbtn.active = false;
            }
        }else{
            yjrhbtn.active = false;
            tjrhbtn.active = false;
        }
    },

    refreshAllSkill:function(){

        var role = _MRDL._ROLEARR[_MRDL._PAGEINDEX];
        var realskill = _ROLEDATA.getSkillOfplayer(role);
        var mainLabel = _MRDL._MAINLABEL;
        var skillNodes = mainLabel.getChildByName('skillLabel').getChildByName('skills').getChildren();
        mainLabel.getChildByName('skillLabel')
        .getChildByName('page')
        .getChildByName('label').getComponent(cc.Label).string
         = "第"+(_MRDL._SKILLPAGENMB+1)+"页(技能总数:"+realskill.length+")";
        var startIndex = _MRDL._SKILLPAGENMB*_MRDL._SKILLPAGENSIZE;

        for(var i=0;i<skillNodes.length;i++){
            var realindex = startIndex+i;
            if(realskill&&realskill[realindex]){
                _MRDL.refreshSkill(skillNodes[i],realskill[realindex]);
            }else{
                _MRDL.refreshSkill(skillNodes[i],null);
            }
        }

    },

    //刷新装备栏
    refreshEquipArr:function(equipNodes,jobEquip,realequip){

        var jobEquipCopy = _CU.cloneObj(jobEquip);

        for(var i=0;i<equipNodes.length;i++){
            if(realequip&&realequip[i]){

                equipNodes[i].active = true;

                var ename = realequip[i].type;
                var econf = _EQUIP[ename];
                var etype = null;
                if(econf){
                    etype = econf.type;
                    for(var j=0;j<jobEquipCopy.length;j++){
                        if(etype==jobEquipCopy[j]){
                            jobEquipCopy.splice(j,1);
                            break;
                        }
                    }
                }

                _MRDL.refreshEquip(
                    equipNodes[i],
                    realequip[i],
                    etype
                );
            }else if(jobEquipCopy.length>0){

                equipNodes[i].active = true;

                _MRDL.refreshEquip(
                    equipNodes[i],
                    null,
                    jobEquipCopy[0]
                );
                jobEquipCopy.splice(0,1);
            }else{
                equipNodes[i].active = false;
            }
        }

    },

    //刷新装备格子
    refreshEquip:function(equipNode,equipInfo,equipType){

        var imgNode = equipNode.getChildByName('img');
        var starNode = equipNode.getChildByName('xinxin');
        var nmbNode = equipNode.getChildByName('forging');
        var etypeNodes = equipNode.getChildByName('etype').getChildren();
        var bgNode = equipNode;
        var yjdzBtn = equipNode.getChildByName('start');
        var dztips = equipNode.getChildByName('jb_kd');
        yjdzBtn.active = false;
        dztips.active = false;
        
        starNode.active = false;

        for(var i=0;i<etypeNodes.length;i++){
            if(etypeNodes[i].getName()==equipType){
                etypeNodes[i].active = true;
            }else{
                etypeNodes[i].active = false;
            }
        }

        if(equipInfo){
            
            var equipConf = _EQUIP[equipInfo.type];
            if(equipConf){
                imgNode.active = true;
                imgNode.getComponent(cc.Sprite).spriteFrame = _GRM.getEquipFrame(equipConf.img);
            }else{
                imgNode.active = false;
            }
            bgNode.color = new cc.color(_CS.qua[equipInfo.qua].color);

            var dzlevel = equipInfo.dzlevel;
            if(dzlevel>0){
                nmbNode.active = true;
                nmbNode.getComponent(cc.Label).string = "+"+dzlevel;
            }else{
                nmbNode.active = false;
            }

            if(equipConf.iszs){
                starNode.active = true;
            }

            if(_MRDL._CURRENTSENCE==_STYPE._GOODSSENCE
                ||_MRDL._CURRENTSENCE==_STYPE._TEAMSENCE
            ){
                var role = _MRDL._ROLEARR[_MRDL._PAGEINDEX];
                var result = _MDZ.isequipdz(equipInfo,role);
                if(result.status){
                    yjdzBtn.active = true;
                    dztips.active = true;
                    yjdzBtn.equip = equipInfo;
                    yjdzBtn.role = role;
                }
            }

        }else{
            imgNode.active = false;
            nmbNode.active = false;
            bgNode.color = new cc.color("#161410");
        }


    },


    //控制显示左右箭头
    refreshLR:function(mainLabel){

        var btnLeft = mainLabel.getChildByName('page').getChildByName('btnLeft');
        var btnRight = mainLabel.getChildByName('page').getChildByName('btnRight');

        btnLeft.active = !(_MRDL._PAGEINDEX==0);
        btnRight.active = !(_MRDL._PAGEINDEX+1>_MRDL._ROLEARR.length-1)

    },

    //刷新修为列表
    refreshXW:function(){
        var mainLabel = _MRDL._MAINLABEL;
        var role = _MRDL._ROLEARR[_MRDL._PAGEINDEX];
        var xwNodes = mainLabel.getChildByName('xiuweiLabel').getChildByName('bars').getChildren();

        var xwConfig=_ROLEDATA.getRoleXwLevel(role);

        if(!role.xw){
            role.xw={};
            for(var key in xwConfig){
                role.xw[key]=0;
            }
        }

        for(var i=0;i<xwNodes.length;i++){
            xwNodes[i].active = false;
        }


        var index = 0;
        var xwindex = 0;
        var startindex = _MRDL._XWPAGENMB*_MRDL._XWPAGESIZE;
        for(var key in role.xw){
            if(xwindex>=startindex){
                if(index<xwNodes.length){
                    xwNodes[index].xw = key;
                    _MRDL.refreshOneXW(xwNodes[index],key,role.xw[key],xwConfig[key]);
                }
                index++;
            }
            xwindex++;
        }

        mainLabel.getChildByName('xiuweiLabel')
        .getChildByName('page')
        .getChildByName('label').getComponent(cc.Label).string
         = "第"+(_MRDL._XWPAGENMB+1)+"页(修为总数:"+xwindex+")";
    },

    refreshOneXW:function(xwNode,key,value,xwlevel){
        if(_XW[key]){
            xwNode.active = true;

            var nameNode = xwNode.getChildByName("name");
            var czdataNode = xwNode.getChildByName("czdata");
            var tipsNode = xwNode.getChildByName("tips");
            var xwdataNode = xwNode.getChildByName("xwdata");
            var progressNode = xwNode.getChildByName("progress");

            nameNode.getComponent(cc.Label).string = _XW[key].label;
            nameNode.color = new cc.color(_CS.attrColor[_XW[key].attr])

            xwdataNode.getComponent(cc.Label).string = "修为:"+value.toFixed(1);

            if(xwlevel){
                czdataNode.getComponent(cc.Label).string = "成长:"+xwlevel;
                czdataNode.color = new cc.color(_CS.qua[xwlevel].color)
                tipsNode.getComponent(cc.Label).string ="升级后修为概率增长"+_XWLEVEL[xwlevel][0]+"~"+_XWLEVEL[xwlevel][1];
            }else{
                czdataNode.getComponent(cc.Label).string = "成长:未知";
                czdataNode.color = new cc.color("#FFFFFF")
                tipsNode.getComponent(cc.Label).string ="未知修为无法成长";
            
            }

            progressNode.getComponent(cc.ProgressBar).progress = value/_CS.maxxw;
        }
    },

    //切换tab
    switchLabel:function(labelName){
        _MRDL._MAINLABEL.getChildByName('mainLabel').active = false;
        _MRDL._MAINLABEL.getChildByName('addLabel').active = false;
        _MRDL._MAINLABEL.getChildByName('skillLabel').active = false;
        _MRDL._MAINLABEL.getChildByName('xiuweiLabel').active = false;
        //_MRDL._MAINLABEL.getChildByName('fiveLabel').active = false;
        _MRDL._MAINLABEL.getChildByName(labelName).active = true;
    },

    showTap:function(){
        //console.log('切换界面',this.getName());
        _MRDL.switchLabel(this.getName()+"Label");
    },

    showEquip:function(){
        
        var role = _MRDL._ROLEARR[_MRDL._PAGEINDEX];
        if(role&&role.equip&&role.equip[this.equipIndex]){

            //var parentNode = _MRDL._CURRENTSENCE==_STYPE._FIGHTSENCE?_FIGHT.node:_MAP.node;
            var scal = _MRDL._CURRENTSENCE==_STYPE._FIGHTSENCE?0.8:1;
            _MGD.showGoodsUi(null,role.equip[this.equipIndex],{
                sence:_MRDL._CURRENTSENCE,
                pos:_MGD._POSROLEEQUIP,
                equipIndex:this.equipIndex,
                scal:scal
            });

        }
    },

    showSkill:function(){
        var role = _MRDL._ROLEARR[_MRDL._PAGEINDEX];
        var realskill = _ROLEDATA.getSkillOfplayer(role);
        var startIndex = _MRDL._SKILLPAGENMB*_MRDL._SKILLPAGENSIZE;
        var realIndex = this.skillIndex+startIndex;
        if(realskill&&realskill[realIndex]){

            //var parentNode = _MRDL._CURRENTSENCE==_STYPE._FIGHTSENCE?_FIGHT.node:_MAP.node;
            var scal = _MRDL._CURRENTSENCE==_STYPE._FIGHTSENCE?0.8:1;
            _MGD.showGoodsUi(null,_IOF.createObjByName(realskill[realIndex],null),{
                sence:_MRDL._CURRENTSENCE,
                pos:_MGD._POSROLESKILL,
                skillIndex:realIndex,
                scal:scal
            });
            
        }
    },

    showRename:function(){
        console.log('修改名称');
    },

    pageClick:function(){
        //console.log('翻页',this.pageDir);
        if(_MRDL._PAGEINDEX+this.pageDir<0
            ||_MRDL._PAGEINDEX+this.pageDir>_MRDL._ROLEARR.length-1){
            return;
        }else{
            _MRDL._PAGEINDEX+=this.pageDir;
            _MRDL.refreshPage();
            if(_MRDL._CURRENTSENCE==_STYPE._GOODSSENCE){
                _MG.refreshPage(_MG._CURRENTLABEL);
            }
        }
    },

    refreshSkill:function(skillNode,skill){

        skillNode.active = true;

        var bgNode = skillNode.getChildByName('guan_skill');
        var nameNode = skillNode.getChildByName('label');
        var typeNode = skillNode.getChildByName('qiu');
        var noneNode = skillNode.getChildByName('img_add');
        var starNode = skillNode.getChildByName('xinxin');
        var ftypeNode = skillNode.getChildByName('wuxin'); 
        var skillObj = null;

        if(skill){

            noneNode.active = false;
            starNode.active = true;
            //typeNode.active = true;
            nameNode.active = true;
            bgNode.active = true;
            ftypeNode.active = true;

            nameNode.getComponent(cc.Label).string = skill;
            if(_SKILL[skill]){
                typeNode.getChildByName('label').getComponent(cc.Label).string = '主';
                skillObj = _SKILL[skill]
            }else{
                typeNode.getChildByName('label').getComponent(cc.Label).string = '被';
                skillObj = _SKILLBD[skill];
            }

            //if(skillObj&&skillObj.bossflag){
            if(_SKILLHEPLER.isZhuanshu(skill)){
                starNode.active = true;
            }else{
                starNode.active = false;
            }

            if(skillObj&&skillObj.ftype&&_CS.ftype[skillObj.ftype]){
                ftypeNode.active =true;
                ftypeNode.getChildByName('label').getComponent(cc.Label).string = skillObj.ftype;
                ftypeNode.color = new cc.color(_CS.ftype[skillObj.ftype].color);
            }else{
                ftypeNode.active =false;
            }

            if(
                skillObj
                &&skillObj.qua
                &&_CS.qua[skillObj.qua]
                &&_CS.qua[skillObj.qua].color
            ){
                bgNode.color = new cc.color(_CS.qua[skillObj.qua].color);
            }else{
                bgNode.color = new cc.color("#000000");
            }

        }else{

            noneNode.active = true;
            starNode.active = false;
            typeNode.active = false;
            nameNode.active = false;
            bgNode.active = false;
            ftypeNode.active = false;

        }

    },

    //画六维图，并填充
	drawSix(attrNodes,graphics,dataArr) {

        attrNodes.getChildByName('plv').getComponent(cc.Label).string='武:'+dataArr[0];
        attrNodes.getChildByName('plv').color = new cc.color(_CS.attrColor['attack'])
        attrNodes.getChildByName('dlv').getComponent(cc.Label).string='统:'+dataArr[1];
        attrNodes.getChildByName('dlv').color = new cc.color(_CS.attrColor['defend'])
        attrNodes.getChildByName('ilv').getComponent(cc.Label).string='智:'+dataArr[2];
        attrNodes.getChildByName('ilv').color = new cc.color(_CS.attrColor['mattack'])
        attrNodes.getChildByName('mlv').getComponent(cc.Label).string='德:'+dataArr[3];
        attrNodes.getChildByName('mlv').color = new cc.color(_CS.attrColor['mdefend'])
        attrNodes.getChildByName('hlv').getComponent(cc.Label).string='体:'+dataArr[4];
        attrNodes.getChildByName('hlv').color = new cc.color(_CS.attrColor['maxHp'])

        var per = _MRDL.paramLength/_MRDL.maxlength;
        _CU.drawData(graphics,dataArr,per);
      
	},


    getCurrentRole:function(){
        if(_MRDL._ROLEARR)
            return _MRDL._ROLEARR[_MRDL._PAGEINDEX];

        return null;
    }

}